from app.monitor_logs.models import MonitorLogExcludeKeyword
from app.monitor_logs.models import MonitorLogPolicy
from app.monitor_logs.models import MonitorLogService

if __name__ == "__main__":
    import datetime
    from common.database import SessionLocal

    session = SessionLocal()
    current_datetime = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

    MonitorLogService.get_exclude_keyword_by_service_name(session, "message-sms", current_datetime)
#     from common.database import SessionLocal
#
#     #
#
#     session = SessionLocal()
#     log_service_obj = MonitorLogExcludeKeyword.add(session, {'username': "boll.lai",
#                                                              'exclude_keyword': [], 'is_active': True,
#                                                              "effective_datetime": "2023-03-27 09:00",
#                                                              "expiration_datetime": "2023-03-27 09:30"})
#
#     monitor_log_policy = MonitorLogPolicy.add(session, {"policy_name": "user-center", "alarm_threshold": 50, "is_maintain": True,
#                                                         "maintain_begin_time": "2023-03-27 09:00",
#                                                         "maintain_end_time": "2023-03-27 10:00", "alarm_plan": {"a": "1"},
#                                                         'to_exclude_keyword': log_service_obj})
